Skip to content

Release loader callbacks after compilation - #20531

Merged
RobinMalfait merged 3 commits into
tailwindlabs:mainfrom
tamird:codex/release-compiler-options
Oct 9, 2026
Merged

RobinMalfait merged 3 commits into
tailwindlabs:mainfrom
tamird:codex/release-compiler-options

Conversation

@tamird

@tamird tamird commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Cached compilers retain the module and stylesheet loader callbacks after compilation. Callbacks supplied by build tools can capture completed build state, keeping it alive during later builds.

Capture the from and polyfills values used by subsequent builds and isolate config and plugin loading from the compatibility theme resolver's scope. This allows the loader callbacks and their captured state to be collected after compilation.

Test plan

The regression keeps the compiler alive across garbage collection, verifies that both loader callbacks can be collected, and confirms that a subsequent utility build still works.

  • corepack pnpm test:integrations postcss/compiler-lifetime.test.ts (Node.js 24.19.0)
  • corepack pnpm run test (Node.js 24.19.0)
  • corepack pnpm build (Node.js 22.23.3)

The complete integration suite remains unverified locally because several framework fixtures require filesystem and network capabilities unavailable in the sandbox. Lint stopped on generated files and embedded templates; the scoped type check reports the same diagnostics on the unchanged base.

Cached compilers retain the module and stylesheet loader callbacks
after compilation. Callbacks supplied by build tools can capture
completed build state, keeping it alive during later builds.

Capture the from and polyfills values used by subsequent builds and
isolate config and plugin loading from the compatibility theme
resolver's scope. This allows the loader callbacks and their captured
state to be collected after compilation.

Add a regression that keeps the compiler usable after both loader
callbacks are collected.
@tamird
tamird requested a review from a team as a code owner October 1, 2026 03:08
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain.

Reviews (2) · Last reviewed commit: "Add CHANGELOG entry for #20531" · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f87d1fad-71e7-4ab0-9aeb-64f7018a6cbf

📥 Commits

Reviewing files that changed from the base of the PR and between e8e1178 and 2a6cfed.


📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/tailwindcss/src/compiler-lifetime.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



Walkthrough

The compiler captures source-location and polyfill options in local values. Compatibility config and plugin loading move into a helper. A new test checks whether stylesheet and module loader callbacks are released after compilation and whether the compiler can still build CSS containing .flex. The Unreleased changelog records the callback lifetime fix.

Priority: ⬇️ Low

Merge Risk

Merge Risk: ⚪ Minimal · up to 2a6cf

No actionable issue is established in the supplied review. Merge after normal validation, with the reported integration-suite limitation noted.

Security Architecture Review

Security architecture risk: 🔵 Low · up to e8e11

The inspected change reduces retained build state without broadening module-loading authority. No introduced security concern was identified, but failure, concurrency, and downstream integration behavior have not been fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced exposure remains the compiling host's loader policy and retained compiler state. Control of stylesheet directives can influence the module IDs sent to that loader, but the inspected change does not broaden the available loader authority. Tenant isolation, credentials, service exposure, and deployment-specific permissions are not established by the supplied context.

Trust Boundaries and Controls

  • observed — Base-to-head comparison preserves top-level directive restrictions, plugin option parsing, context-derived base/reference/source metadata, and the config/plugin resource hints passed to the loader. The changed aliases and helper do not introduce a new route around those checks.

Resilience and Maintainability Implications

  • inferred — A rejected compatibility load still prevents successful compiler publication. The unchanged Promise.all structure does not cancel other in-flight loader work or roll back loader side effects, so rejection is not transactional isolation. That limitation predates this extraction; no new failure-containment weakness was identified in the inspected transition.



Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: releasing loader callbacks after compilation.
Description check Passed The description directly explains the callback lifetime issue, the implementation approach, regression coverage, and validation results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sharmila-oai

Copy link
Copy Markdown

@RobinMalfait do you mind taking a look? 🙏

The integration test lived in `integrations/postcss` but does not use
PostCSS, and it needed a full fixture install to run. The unit test gets
`gc()` through `v8.setFlagsFromString` instead of the `--expose-gc`
flag, so it runs with the rest of the `tailwindcss` tests.
@RobinMalfait
RobinMalfait enabled auto-merge (squash) October 9, 2026 21:18

@RobinMalfait RobinMalfait left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@RobinMalfait
RobinMalfait merged commit de2255b into tailwindlabs:main Oct 9, 2026
9 of 10 checks passed
@tamird
tamird deleted the codex/release-compiler-options branch October 9, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants